package cnpm.service.impl;

import cnpm.dao.UserDAO;
import cnpm.dao.impl.UserDAOImpl;
import cnpm.entity.User;
import cnpm.service.UserService;

public class UserServiceImpl implements UserService {

	private UserDAO userDAO; 
	
	public UserServiceImpl() {
		userDAO = new UserDAOImpl();
	}
	
	@Override
	public User getUser(String username) {
		return userDAO.getUser(username);
	}

	@Override
	public boolean isValidate(String username, String password) {
		User user = getUser(username);
		if(user != null){
			if(user.getUsername().equals(username) && user.getPassword().equals(password)){
				return true;
			}
		}
		return false;
	}
	
}
